﻿using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;

namespace Coder.Beer.Robot.Api.Migrations
{
    public partial class PK1 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "NodeBBUser",
                columns: table => new
                {
                    UId = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    Username = table.Column<string>(type: "text", nullable: true),
                    LastOnline = table.Column<long>(type: "bigint", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NodeBBUser", x => x.UId);
                });

            migrationBuilder.CreateTable(
                name: "NodeBBPosts",
                columns: table => new
                {
                    PId = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    UserUId = table.Column<int>(type: "integer", nullable: true),
                    TopicTId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NodeBBPosts", x => x.PId);
                });

            migrationBuilder.CreateIndex(
                name: "IX_NodeBBPosts_TopicTId",
                table: "NodeBBPosts",
                column: "TopicTId");

            migrationBuilder.CreateIndex(
                name: "IX_NodeBBPosts_UserUId",
                table: "NodeBBPosts",
                column: "UserUId");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "NodeBBPosts");

            migrationBuilder.DropTable(
                name: "NodeBBUser");
        }
    }
}
